{$CLEO .ep}
//engine.ep//

const
    _time1 = 1500 // ms
    _time2 = 3000 // ms
end

0000:
:main
while true
    003D:
    if 
        player.Defined($PLAYER_CHAR)
    then
        if 
            actor.Driving($PLAYER_ACTOR)
        then
            0811: 8@ = actor $PLAYER_ACTOR car_nosave
            08EC: 10@ = car 8@ type 
            if
                 10@ == 3
            then
                if and
                    00E1: player 0 pressed_key 6  // Handbrake
                    00E1: player 0 pressed_key 16 // Accelerate
                then
                    if
                        32@ > _time1
                    then
                        goto @wait
                    end
                else
                    32@ = 0
                end
            else
                32@ = 0
            end
        else
            32@ = 0
        end
    else
        32@ = 0
    end
end

:wait
while true
    003D:
    if
        not player.Defined($PLAYER_CHAR)
    then
        32@ = 0
        goto @main
    end
    if
        not actor.Driving($PLAYER_ACTOR)
    then
        32@ = 0
        goto @main
    end
    0811: 8@ = actor $PLAYER_ACTOR car_nosave
    08EC: 10@ = car 8@ type 
    if
        10@ <> 3
    then
        32@ = 0
        goto @main
    end
    if
        80E1: not player 0 pressed_key 16 // Accelerate
    then
        goto @make_effect
    end
    if
        32@ > _time2
    then
        goto @make_effect
    end
end

:make_effect
0811: 8@ = actor $PLAYER_ACTOR car_nosave 
0A97: 7@ = car 8@ struct
7@ += 0x22 
0A8D: 7@ = read_memory 7@ size 2 virtual_protect 0
7@ *= 4
7@ += 0xA9B0C8
0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0
7@ += 0x5C                                        
0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0
7@ += 0x48
0A8D: 1@ = read_memory 7@ size 4 virtual_protect 0
7@ += 4
0A8D: 2@ = read_memory 7@ size 4 virtual_protect 0
7@ += 4
0A8D: 3@ = read_memory 7@ size 4 virtual_protect 0
if
    actor.DrivingVehicleType($PLAYER_ACTOR, #BANSHEE)
then
    9@ = 60.0
else
    9@ = 0.0
end
066C: 6@ = attach_particle "gunflash" to_car 8@ with_offset 1@ 2@ 3@ rotation 9@ -100.0 0.0 type 1
064C: make_particle 6@ visible
064F: remove_references_to_particle 6@
0A97: 7@ = car 8@ struct
7@ += 0x384
0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0
7@ += 0xCC // modelFlags
0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0
if
    08B7: test 7@ bit 13
then
    1@ *= -1.0
    9@ *= -1.0
    066C: 6@ = attach_particle "gunflash" to_car 8@ with_offset 1@ 2@ 3@ rotation 9@ -100.0 0.0 type 1 
    064C: make_particle 6@ visible
    064F: remove_references_to_particle 6@
end     
audiostream.PerformAction(0@, PLAY)
audiostream.LinkToCar(0@, 8@)
32@ = 0
goto @main